// JavaScript Document

/*
*	setSysLoad Form Validation
*	Author: Adam Fernandes
*	Created: June 22, 2008
*
*/


var errorMessage = "";

// new wrapper object
// var ap = new Object();

function addErrorMsg(message){
	errorMessage = errorMessage + message + "<br>";
}


function validate(frm){

	if (isInteger(frm.newSysMaxLoad.value) && frm.newSysMaxLoad.value !='' && frm.newSysMaxLoad.value!=' ' && frm.newSysMaxLoad.value != undefined)
	{
		//alert("System load set to: " + frm.newSysMaxLoad.value);
		return true;
	}
	else
	{
		alert("Invalid System Load Value");
		return false;
	}

}

function validateBillingPeriod(frm){

	if (isInteger(frm.newBillingPeriod.value) && frm.newBillingPeriod.value !='' && frm.newBillingPeriod.value!=' ' && frm.newBillingPeriod.value != undefined && frm.newBillingPeriod.value != 0)
	{
		return true;
	}
	else
	{
		alert("Invalid Billing Period");
		return false;
	}

}

// utility functions

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}


